package com.huangfu.learning.javabase.java.reflect;

/**
 * Created with IntelliJ IDEA.
 * Author: huangfu.daohui
 * Date: 2018/7/12
 * Time: 20:04
 * Version: 1.0
 * Description:
 **/

interface China {
    public static final String name = "zhangsan";
    public static int age = 20;

    public void sayChina();

    public void sayHello(String name, int age);
}

interface Sport {

    public void jump();

}

class GetInterface implements China, Sport {
    public GetInterface() {

    }

    public GetInterface(String sex) {
        this.sex = sex;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public void sayChina() {
        System.out.println("hello ,china");
    }

    @Override
    public void sayHello(String name, int age) {
        System.out.println(name + "  " + age);
    }

    private String sex;

    @Override
    public void jump() {
        System.out.println("jump....");

    }
}

class TestGetInterface {
    public static void main(String[] args) {
        Class<?> getInterface = null;
        try {
            getInterface = Class.forName("com.huangfu.learning.javabase.java.reflect.GetInterface");
        } catch (Exception e) {
            e.printStackTrace();
        }
        //保存所有的接口
        Class<?> intes[] = getInterface.getInterfaces();
        for (int i = 0; i < intes.length; i++) {
            System.out.println("实现的接口   " + intes[i].getName());
        }
    }
}